home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / v cisle / htttrack / httrack-3.41-3.exe / {app} / src_win / WinHTTrack / Shell.h < prev    next >
C/C++ Source or Header  |  2006-05-21  |  7KB  |  252 lines

  1. // Shell.h : main header file for the SHELL application
  2. //
  3.  
  4. #if !defined(AFX_SHELL_H__ED81E637_E017_11D1_A97E_006097BC6150__INCLUDED_)
  5. #define AFX_SHELL_H__ED81E637_E017_11D1_A97E_006097BC6150__INCLUDED_
  6. #if _MSC_VER >= 1000
  7. #pragma once
  8. #endif // _MSC_VER >= 1000
  9. #ifndef __AFXWIN_H__
  10.     #error include 'stdafx.h' before including this file for PCH
  11. #endif
  12.  
  13. /* basic HTTrack defs */
  14. extern "C" {
  15.   #include "htsglobal.h"
  16.   #include "htsopt.h"
  17. }
  18.  
  19. //
  20. // connectΘ via HTTrack? (dΘfini dans projet)
  21. #define USE_RAS 1
  22. //
  23.  
  24. // sleep (taux de refresh) en ms
  25. #define HTS_SLEEP_WIN 100
  26.  
  27. #include "resource.h"       // main symbols
  28. #include "cpp_lang.h"
  29. // Ras
  30. #if USE_RAS
  31. #include "RasLoad.h"
  32. #endif
  33. #include "MainTab.h"
  34.  
  35. // helper launcher
  36. #include "LaunchHelp.h"
  37.  
  38. // lang.h
  39. #include "newlang.h"
  40.  
  41. // message requests
  42. #define wm_ViewRestart (WM_USER + 100)
  43. // test 
  44. #define wm_WizRequest1 (WM_USER + 101)
  45. #define wm_WizRequest2 (WM_USER + 102)
  46. #define wm_WizRequest3 (WM_USER + 103)
  47.  
  48. // char[] dynamiques
  49. #define dynstrcpy(dest,src) { \
  50.   if (dest) free(dest);\
  51.   dest=(char*) malloc(strlen(src)+1);\
  52.   if (dest)\
  53.     strcpy(dest,src);\
  54.   }
  55. #define dynclear(dest) { if (dest) { free(dest); dest=NULL; }}
  56.  
  57. typedef struct t_StatsBuffer {
  58.   char nom[HTS_URLMAXSIZE*2];
  59.   char fichier[HTS_URLMAXSIZE];
  60.   char etat[256];
  61.   char url_sav[HTS_URLMAXSIZE*2];    // pour cancel
  62.   char url_adr[HTS_URLMAXSIZE*2];
  63.   char url_fil[HTS_URLMAXSIZE*2];
  64.   LLint size;
  65.   LLint sizetot;
  66.   int offset;
  67.   //
  68.   int back;
  69.   //
  70.   int actived;    // pour disabled
  71. } t_StatsBuffer;
  72.  
  73. typedef struct InpInfo {
  74.   int ask_refresh;
  75.   int refresh;
  76.   LLint stat_bytes;
  77.   int stat_time;
  78.   int lien_n;
  79.   int lien_tot;
  80.   int stat_nsocket;
  81.   int rate;
  82.   int irate;
  83.   int ft;
  84.   LLint stat_written;
  85.   int stat_updated;
  86.   int stat_errors;
  87.   int stat_warnings;
  88.   int stat_infos;
  89.   TStamp stat_timestart;
  90.   int stat_back;
  91. } InpInfo;
  92.  
  93.  
  94. /* WinHTTrack mutex */
  95. extern HANDLE WhttMutex;
  96. #define WHTT_LOCK() WaitForSingleObject(WhttMutex,INFINITE)
  97. #define WHTT_UNLOCK() ReleaseMutex(WhttMutex)
  98.  
  99. /* Location */
  100. extern char* WhttLocation;
  101. #define WHTT_LOCATION(a) WhttLocation=(a)
  102.  
  103. #ifndef HTS_DEF_FWSTRUCT_lien_back
  104. #define HTS_DEF_FWSTRUCT_lien_back
  105. typedef struct lien_back lien_back;
  106. #endif
  107.  
  108. // fonctions moteur
  109. int   __cdecl httrackengine_check(httrackp *opt, const char* adr,const char* fil,int status);
  110. int   __cdecl httrackengine_check_mime(httrackp *opt, const char* adr,const char* fil,const char* mime,int status);
  111. void  __cdecl httrackengine_init();
  112. void  __cdecl httrackengine_uninit();
  113. int   __cdecl httrackengine_start(httrackp *opt);
  114. int   __cdecl httrackengine_end(httrackp *opt);
  115. int   __cdecl httrackengine_htmlpreprocess(httrackp *opt, char** html,int* len,const char* url_address,const char* url_file);
  116. int   __cdecl httrackengine_htmlpostprocess(httrackp *opt, char** html,int* len,const char* url_address,const char* url_file);
  117. int   __cdecl httrackengine_htmlcheck(httrackp *opt, char* html,int len,const char* url_address,const char* url_file);
  118. int   __cdecl httrackengine_chopt(httrackp *opt);
  119. int   __cdecl httrackengine_loop(httrackp *opt, lien_back* back,int back_max,int back_index,int lien_n,int lien_tot,int stat_time,hts_stat_struct* stats);
  120. const char* __cdecl httrackengine_query(httrackp *opt, const char* question);
  121. const char* __cdecl httrackengine_query2(httrackp *opt, const char* question);
  122. const char* __cdecl httrackengine_query3(httrackp *opt, const char* question);
  123. void  __cdecl httrackengine_pause(httrackp *opt, const char* lockfile);
  124. void  __cdecl httrackengine_filesave(httrackp *opt, const char* file);
  125. void  __cdecl httrackengine_filesave2(httrackp *opt, const char* adr, const char* fil, const char* save, int is_new, int is_modified, int not_updated);
  126.  
  127. extern httrackp *global_opt;
  128.  
  129. // profile
  130. int Save_current_profile(int ask);
  131. //
  132. int MyGetProfileInt(CString path,CString dummy,CString name,int value);
  133. int MyGetProfileIntFile(FILE* fp,CString dummy,CString name,int value);
  134. int MyWriteProfileString(CString path,CString dummy,CString name,CString value);
  135. int MyWriteProfileStringFile(FILE* fp,CString dummy,CString name,CString value);
  136. CString MyGetProfileStringFile(FILE* fp,CString dummy,CString name,CString value);
  137. CString MyGetProfileString(CString path,CString dummy,CString name,CString value="");
  138. void Write_profile(CString path,int load_path);
  139. void Read_profile(CString path,int load_path);
  140. int MyWriteProfileInt(CString path,CString dummy,CString name,int value);
  141. int MyWriteProfileIntFile(FILE* fp,CString dummy,CString name,int value);
  142.  
  143. void Build_TopIndex(BOOL check_empty=TRUE);
  144.  
  145. void InitRAS();
  146.  
  147. // Gestion rΘpertoires
  148. int CheckDirInfo(CString path);
  149. BOOL RemoveEmptyDir(CString path);
  150.  
  151.  
  152. // RAS //
  153. /*
  154. #include "Ras.h"
  155. typedef unsigned long (* t_RasHangUp)(HRASCONN);
  156. */
  157. // RAS END //
  158.  
  159. /* lang extensions */
  160. void SetCombo(CWnd* _this,int id,char* lang_string);
  161.  
  162.  
  163. // HTTrack params - pour le multithread interface/robot
  164. class HTTrack_Params {
  165. public:
  166.   int argc;
  167.   char** argv;
  168.   //
  169.   int* result;
  170. };
  171. typedef struct Robot_params {
  172.   int argc;
  173.   char** argv;
  174. } Robot_params;
  175.  
  176. // Lancement du miroir
  177. BOOL LaunchMirror();
  178.  
  179.  
  180. #define NStatsBuffer                    14
  181.  
  182. /* Class */
  183. class CShellOptions {
  184. public:
  185.   CString LINE, url, filelist, proxy, proxyftp, port, depth, 
  186.     extdepth, get, where, meth, maxfile, max, frag, 
  187.     conn, tog, cache, robots, choixdeb, build, filtre, htmlfirst, 
  188.     index, index2, dos, time, rate, hostquit, ka, 
  189.     user, footer, log, testall, parseall, link, path, 
  190.     retry, errpage, external, nopurge, hidepwd, hidequery, 
  191.     cookies, checktype, parsejava, Cache2, logtype, norecatch, 
  192.     toler, updhack, urlhack, http10, waittime, maxtime, maxrate, 
  193.     maxconn, maxlinks, hh, mm, ss, buff_filtres, buff_MIME, 
  194.     _RasString;
  195.   CString LINE_back;
  196.   RASDIALPARAMS _dial;
  197. };
  198.  
  199. /* Class options */
  200. extern CShellOptions* ShellOptions;
  201.  
  202.  
  203. /////////////////////////////////////////////////////////////////////////////
  204. // CShellApp:
  205. // See Shell.cpp for the implementation of this class
  206. //
  207. //class CShellApp : public CWinApp
  208. class CShellApp
  209. {
  210. public:
  211.     CShellApp();
  212.   void init_lance();
  213.   CString end_path;
  214.   CString end_path_complete;
  215.   /*
  216.   int suivant0(void);
  217.   int suivant1(void);
  218.   int suivant2(void);
  219.   //int suivant3(void);
  220.   int suivant4(void);
  221.   */
  222.   void OptPannel();
  223.  
  224.   //BOOL InitInstance();
  225.   
  226.   /*
  227. // Overrides
  228.     // ClassWizard generated virtual function overrides
  229.     //{{AFX_VIRTUAL(CShellApp)
  230.     public:
  231.     virtual BOOL InitInstance();
  232.     //}}AFX_VIRTUAL
  233.  
  234. // Implementation
  235.  
  236.     //{{AFX_MSG(CShellApp)
  237.     afx_msg void OnAppAbout();
  238.         // NOTE - the ClassWizard will add and remove member functions here.
  239.         //    DO NOT EDIT what you see in these blocks of generated code !
  240.     //}}AFX_MSG
  241.     DECLARE_MESSAGE_MAP()
  242.   */
  243. };
  244.  
  245.  
  246. /////////////////////////////////////////////////////////////////////////////
  247.  
  248. //{{AFX_INSERT_LOCATION}}
  249. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  250.  
  251. #endif // !defined(AFX_SHELL_H__ED81E637_E017_11D1_A97E_006097BC6150__INCLUDED_)
  252.